import os
from ShowapiRequest import ShowapiRequest
import te
import logging

def get_ph(page):
    try:
        r = ShowapiRequest("http://route.showapi.com/1635-1", "98606", "de445ee146fe49a0a8080a6c9bf0bb99")
        r.addBodyPara("page", "1")
        # r.addFilePara("img", r"C:\Users\showa\Desktop\使用过的\4.png") #文件上传时设置
        res = r.post()
        data=res.json()


        if data.get('showapi_res_code') != 0:
            return []
        apilist=data.get('showapi_res_body')
        newlist=[]
        for item in apilist.get('contentlist'):
            newlist.append('%s --- %s' % (item.get('answer'),item.get('question')))

        return newlist
    except Exception as e:
        print(e)

if __name__=='__main__':
    logging.basicConfig(level=logging.DEBUG)
    logging.info('error')
    a=(1,2)
    print(a[0])
    # get_ph()
